package main

import (
	"fmt"
	"sync"
	"time"
)

type demo struct {
	A int
	M sync.Mutex
}

func main() {

	var d demo

	go func(a *demo) {
		a.M.Lock()
		a.A = 1
		a.M.Unlock()
	}(&d)
	//d.M.Lock()
	fmt.Println(d.A)
	//d.M.Unlock()
	time.Sleep(2 * time.Second)
}
